﻿using MediatR;
using S.Common.helper;
using S.PurchaseAndSales.Read.Api.Application.Command.SheepSaleCommand;
using S.PurchaseAndSales.Read.Api.Dto;

namespace S.PurchaseAndSales.Read.Api.Application.CommandHandlers.SheepSaleHandler
{
    public class SalesEarTagSelCommandHandler : IRequestHandler<SalesEarTagSelCommand, List<EarTagDto>>
    {
        private readonly IConfiguration configuration;

        public SalesEarTagSelCommandHandler(IConfiguration configuration)
        {
            this.configuration = configuration;
        }


        public  async Task<List<EarTagDto>> Handle(SalesEarTagSelCommand request, CancellationToken cancellationToken)
        {
            var aa = configuration["GetKongaIp"];
            List<EarTagDto> earTagDtos= HttpClientHelper.GetResponseList<EarTagDto>(aa+"/ach/api/SheepFileModel/SalesEarTagSel?id=0");
            return  earTagDtos;
        }
    }
}
